package robuin.ioio.config;


import robuin.ioio.config.R;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;

public class IOIOConfig extends ListActivity {
	
	public final static String EXTRA_MESSAGE = "robuin.ioio.config.MESSAGE";
    private TextView mStatus;
    
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        mStatus = (TextView) findViewById(R.id.status);
        mStatus.setText("Idle");
        
        ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
                android.R.layout.simple_list_item_1, mStrings);
        setListAdapter(adapter);
    }
    
    @Override
	protected void onListItemClick(ListView l, View v, int position, long id) {
        
        mStatus.setText(String.valueOf(position));
        Intent i = null;
        switch(position)
        {
        case 0:
        	i = new Intent(this, onBoardLED.class);
        	break;
        case 1:
        	i = new Intent(this, digitalOutput.class);
        	break;
        case 2:
        	i = new Intent(this, digitalInput.class);
        	break;
        case 3:
        	i = new Intent(this, analogInput.class);
        	break;
        case 4:
        	i = new Intent(this, pwmOutput.class);
        	break;
        case 5:
        	i = new Intent(this, servoOutput.class);
        	break;
        case 6:
        	i = new Intent(this, aboutUs.class);
        	break;
        case 7:
        	i = new Intent(this, uartConfig.class);
        	break;
        case 8:
        	i = new Intent(this, aboutUs.class);
        	break;
        case 9:
        	i = new Intent(this, aboutUs.class);
        	break;
        case 10:
        	i = new Intent(this, aboutUs.class);
        	break;
        }
        if(i != null)
        	startActivity(i);
    }

    private String[] mStrings = {
    		"LED on Board", "Digital Output", "Digital Input", "Analog Input",  "PWM Output", "Servo Output", "Pulse Input", "UART", "SPI", "TWI", "About Us"
    };
}
